﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_MailDelete]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_MailDelete];
GO
-------------------------------------------------------------------------------
-- sproc_MailDelete
--MailIDStr 格式示例: MailID=12 or MailID=34 or MailID=56
-------------------------------------------------------------------------------
CREATE PROCEDURE [dbo].[sproc_MailDelete]
(
    @MailIDStr NVarchar(4000),
    @DeleteType int =1
    
)
AS
    DECLARE @Sql NVarchar(4000)
IF @DeleteType=0
BEGIN
   
     SET @Sql =  "UPDATE TabMailList SET MailFolderType=3   WHERE "+ @MailIDStr
    EXEC (@Sql)    
END
ELSE
BEGIN
   
    SET @Sql=" DELETE FROM TabMailList  WHERE "+@MailIDStr
    EXEC (@Sql)
END